<script type="text/javascript">
xe.lang.confirm_delete = "{$lang->confirm_delete}";
xe.current_layout = {$current_layout};
jQuery( function() { jQuery('.grant_default').change( function(event) { doShowMenuGrantZone(); } ); doShowMenuGrantZone() } );
</script>
<load target="./js/menu_admin.js" usecdn="true" />
<load target="../../admin/tpl/js/sitemap.js" usecdn="true" />
<load target="./js/sitemap.js" usecdn="true" />

<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
	<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<h1 class="h1">{$lang->menu_gnb_sub['siteMap']}</h1>
<block loop="$menu_list=>$key,$value">
{@$menuSrl = $value->menuSrl}
<form class="portlet siteMap" id="menu_{$menuSrl}" method="post" action="#menu_{$menuSrl}">
<input type="hidden" name="module" value="{$module}" />
<input type="hidden" name="act" value="procMenuAdminArrangeItem" />
<input type="hidden" name="menu_srl" value="{$menuSrl}" />
<input type="hidden" name="menu_item_srl" value="" />
<input type="hidden" name="success_return_url" value="{getUrl('', 'module', ($module ? $module : 'admin'), 'act', 'dispMenuAdminSiteMap')}#menuTop_{$menuSrl}" />

	<h2 class="h2" id="menuTop_{$menuSrl}"><input name="title" value="{$value->title}" /></h2>
	<a href="#nav_{$key}" class="tgMap">{$lang->collapsing}/{$lang->expanding}</a>
	<ul class="lined" id="nav_{$key}" cond="count($value->menuItems->list > 0)" <!--@if($_COOKIE['sitemap_toggle_#nav_'.$key])-->style="display:none;"<!--@end-->>
	<block loop="$value->menuItems->list=>$key2,$value2">
	{@$item = $value2}
	<include target="sitemap.item.html" />
	</block>
	</ul>
	<p class="btnArea">
		<span class="btn"><a href="#editMenu" class="modalAnchor _add">{$lang->add_menu}...</a></span>
		<span class="btn"><button value="procMenuAdminArrangeItem" name="act" type="submit">{$lang->cmd_save}</button></span>
		<span class="etc">
			<span class="btn"><button value="procMenuAdminDelete" name="act" type="submit" onclick="return confirmDelete();">{$lang->cmd_delete}</button></span>
			<span class="btn"><a href="#remakeCache" onclick="doReloadTreeMenu('{$menuSrl}');return false;">{$lang->cmd_remake_cache}</a></span>
		</span>
	</p>
</form>
</block>

<form action="./" method="post" class="form">
<input type="hidden" name="module" value="{$module}" />
<input type="hidden" name="act" value="procMenuAdminInsert" />
<input type="hidden" name="title" value="{$lang->untitle}" />
<input type="hidden" name="success_return_url" value="{getUrl('', 'module', ($module ? $module : 'admin'), 'act', 'dispMenuAdminSiteMap')}" />
<div class="btnArea">
	<span class="btn medium"><button type="submit">{$lang->add_new_sitemap}</button></span>
</div>
</form>
<div class="modal" id="editMenu">
	<div class="fg">
		<form ruleset="insertMenuItem" id="editForm" action="./" method="post" enctype="multipart/form-data" class="form">
		<input type="hidden" name="module" value="menu" />
		<input type="hidden" name="act" value="procMenuAdminInsertItem" />
		<input type="hidden" name="menu_srl" value="" />
		<input type="hidden" name="menu_item_srl" value="{$menu_info->menu_srl}" />
		<input type="hidden" name="parent_srl" value="{$menu_info->menu_srl}" />
		<input type="hidden" name="module_srl" value="" />
		<input type="hidden" name="success_return_url" value="{getUrl('', 'module', ($module ? $module : 'admin'), 'act', 'dispMenuAdminSiteMap')}#menuTop_" />
		<h2 class="h2"><span>{$lang->add_menu}</span><span>{$lang->edit_menu}</span></h2>
			<ul>
				<li>
					<p class="q"><label for="name">{$lang->menu_name}({$lang->browser_title}) <em>*</em></label></p>
					<div class="a multiLangEdit">
						<input type="hidden" class="vLang" name="menu_name_key" />
						<input type="text" class="vLang" id="name" name="menu_name" />
						<!-- Multilingual -->
						<div id="langEdit" class="langEdit tgContent">
							<ul class="langList"></ul>
							<div class="langInput">
								<h2>{$lang->multilingual} <strong>{$lang->cmd_modify}...</strong> | <a href="#langEdit">{$lang->cmd_insert}</a></h2>
								<ul>
									{@
										/* move current language to the top */
										$a = array($lang_type=>$lang_supported[$lang_type]);
										unset($lang_supported[$lang_type]);
										$lang_supported = array_merge($a, $lang_supported);
									}
									<li loop="$lang_supported=>$code,$name" class="{$code}"><label for="{$code}_var1">{$name}</label> <input type="text" value="" id="{$code}_var1" /></li>
								</ul>
								<div class="action">
									<div class="btnArea">
										<span class="btn small"><input type="submit" value="{$lang->use}|{$lang->use_after_save}" /></span>
									</div>
									<p><a href="{getUrl('act','dispModuleAdminLangcode')}">{$lang->multilingual_manager}</a></p>
								</div>
							</div>
						</div>
						<!-- /Multilingual -->
						<span class="desc"><a href="#langEdit" class="editUserLang tgAnchor">{$lang->cmd_set_multilingual}</a></span>
					</div>
				</li>
				<li>
					<p class="q">{$lang->module_or_url} <em>*</em></p>
					<p class="a">
						<input type="radio" name="cType" id="cModule" class="_typeCheck" value="CREATE" /> <label for="cModule">{$lang->create_module_in_menu}</label>
						<input type="radio" name="cType" id="sModule" class="_typeCheck" value="SELECT" /> <label for="sModule">{$lang->select_module_in_menu}</label>
						<input type="radio" name="cType" id="url" class="_typeCheck" value="URL" /> <label for="url">{$lang->menu_url}</label>
					</p>
				</li>
				<li id="kindModule">
					<p class="q"><label for="kModule">{$lang->select_module_in_menu} <em>*</em></label></p>
					<p class="a">
						<select style="width:290px" id="kModule" name="module_type">
							<block loop="$module_list=>$key,$value">
							<optgroup label="{$lang->page}" cond="$key=='page'">
								<option value="ARTICLE">{$lang->page_type_name['ARTICLE']}</option>
								<option value="WIDGET">{$lang->page_type_name['WIDGET']}</option>
								<option value="OUTSIDE">{$lang->page_type_name['OUTSIDE']}</option>
							</optgroup>
							<option value="{$key}" cond="$key!='page'">{$value->title}</option>
							</block>
						</select>
						<select style="width:290px" id="sModule_id" name="select_menu_url">
						</select>
					</p>
				</li>
				<li id="createModule">
					<p class="q"><label for="cModule_id">{$lang->create_mid_in_menu} <em>*</em></label></p>
					<div class="a">
						<input type="text" id="cModule_id" name="create_menu_url" />
					</div>
				</li>
				<li id="insertUrl">
					<p class="q"><label for="link_url">{$lang->menu_url} <em>*</em></label></p>
					<div class="a">
						<input type="text" id="link_url" name="menu_url" value="http://" />
					</div>
				</li>
				<li id="selectLayout">
					<p class="q"><label for="layoutSrl">{$lang->layout} <em>*</em></label></p>
					<div class="a">
						<select name="layout_srl" id="layoutSrl">
							<option value="0">{$lang->notuse}</option>
							<option loop="$layout_list => $key, $val" value="{$val->layout_srl}" <!--@if($val->layout_srl == $current_layout)-->selected="selected"<!--@end-->>{$val->title} ({$val->layout})</option>
						</select>
					</div>
				</li>
				<li>
					<p class="q">{$lang->about_menu_open_window} <em>*</em></p>
					<p class="a">
						<input type="radio" name="menu_open_window" id="self" value="N" /> <label for="self">{$lang->menu_self_window}</label>
						<input type="radio" name="menu_open_window" id="blank" value="Y" /> <label for="blank">{$lang->menu_open_window}</label>
					</p>
				</li>
				<li>
					<p class="q">{$lang->menu_img_btn}</p>
					<p class="a">
						<span id="normal_btn_preview"></span><br />
						<input type="file" name="menu_normal_btn" id="menu_normal_btn" /> <label for="menu_normal_btn">{$lang->menu_normal_btn}</label><br />
						<span id="hover_btn_preview"></span><br />
						<input type="file" name="menu_hover_btn" id="menu_hover_btn" /> <label for="menu_hover_btn">{$lang->menu_hover_btn}</label><br />
						<span id="active_btn_preview"></span><br />
						<input type="file" name="menu_active_btn" id="menu_active_btn" /> <label for="menu_active_btn">{$lang->menu_active_btn}</label>
					</p>
				</li>
				<li>
					<p class="q">{$lang->exposure_limits}</p>
					<p class="a" id="groupList">
						<select name="menu_grant_default" class="grant_default">
							<option value="0" selected="selected">{$lang->grant_to_all}</option>
							<option value="-1">{$lang->grant_to_login_user}</option>
							<option value="">{$lang->grant_to_group}</option>
						</select>
						<div id="zone_menu_grant" style="display:none">
							<block loop="$group_list=>$key,$value"><input type="checkbox" name="group_srls[]" id="group_srls_{$value->group_srl}" value="{$value->group_srl}" /> <label for="group_srls_{$value->group_srl}">{$value->title}</label></block>
						</div>
					</p>
				</li>
				<li>
					<p class="q">{$lang->expand}</p>
					<p class="a" id="expand">
						<input type="checkbox" name="menu_expand" value="Y" /> {$lang->about_expand}
					</p>
				</li>
			</ul>
			<div class="btnArea">
				<span class="btn"><input type="submit" value="{$lang->cmd_save}" /></span>
			</div>
		</form>
	</div>
</div>
